import { Component } from 'react'
import "taro-ui/dist/style/components/avatar.scss";
import "taro-ui/dist/style/components/search-bar.scss";
import "taro-ui/dist/style/components/icon.scss";
import "taro-ui/dist/style/components/button.scss" // 按需引入
import './healthimf.less'
import Taro　from '@tarojs/taro';
import TabBar from '../common/tabBar'
import { View,Text } from '@tarojs/components'
import { AtInput, AtForm, AtTag,AtIcon,AtButton,AtAvatar,AtCalendar} from 'taro-ui'
import "taro-ui/dist/style/components/input.scss";
import "taro-ui/dist/style/components/icon.scss";
import "taro-ui/dist/style/components/tag.scss";
import "taro-ui/dist/style/components/button.scss";
import "taro-ui/dist/style/components/loading.scss";
import "taro-ui/dist/style/components/calendar.scss";
export default class Healthimf extends Component {
  constructor() {
    super(...arguments),
      this.state = {
        username: "",
        sex: "",
        borndata: "",
        phone: "",
        address: "",
        nation: "",
        blood: "",
        culture: "",
        profession: "",
        hight: "",
        wealth: "",
        BMI: "",
        jibingshi: "",
        food: "",
        active1: "",
        active2: "",
        active3: "",
        active4: "",
        active5: "",
        active6: "",
        active7: "",
        active8: "",
        active9: "",
        active10: "",
        active11: "",
        active12: "",
        active13: "",
        active14: "",
        active15: "",
        active16: "",
        active17: "",
        active18: "",
        activenan: "",
        activenv: "",
        xiangshi:'none'
      }
    this.JJ = this.JJ.bind(this)
  }

  usernameinput(value) {
    this.setState({
      username: value
    })
    console.log(value)
  }

  sexinput(value) {
    this.setState({
      sex: value
    })
  }

  borndatainput(value) {
    this.setState({
      borndata: value
    })
  }

  phoneinput(value) {
    this.setState({
      phone: value
    })
    console.log(value)
  }

  addressinput(value) {
    this.setState({
      address: value
    })
  }

  nationinput(value) {
    this.setState({
      nation: value
    })
  }

  bloodinput(value) {
    this.setState({
      blood: value
    })
  }

  cultureinput(value) {
    this.setState({
      culture: value
    })
  }

  professioninput(value) {
    this.setState({
      profession: value
    })
  }

  hightinput(value) {
    this.setState({
      hight: value
    })
  }

  wealthinput(value) {
    this.setState({
      wealth: value
    })
  }

  BMIinput(value) {
    this.setState({
      BMI: value
    })
  }

  select1(value) {
    if (value == "" || value == false) {
      this.setState({
        active1: true
      })
    } else {
      this.setState({
        active1: false
      })
    }
  }

  select2(value) {
    if (value == "" || value == false) {
      this.setState({
        active2: true
      })
    } else {
      this.setState({
        active2: false
      })
    }
  }

  select3(value) {
    if (value == "" || value == false) {
      this.setState({
        active3: true
      })
    } else {
      this.setState({
        active3: false
      })
    }
  }

  select4(value) {
    if (value == "" || value == false) {
      this.setState({
        active4: true
      })
    } else {
      this.setState({
        active4: false
      })
    }
  }
    select5(value)
    {
      if (value == "" || value == false) {
        this.setState({
          active5: true
        })
      } else {
        this.setState({
          active5: false
        })
      }
    }
    select6(value)
    {
      if (value == "" || value == false) {
        this.setState({
          active6: true
        })
      } else {
        this.setState({
          active6: false
        })
      }
    }
    select7(value)
    {
      if (value == "" || value == false) {
        this.setState({
          active7: true
        })
      } else {
        this.setState({
          active7: false
        })
      }
    }
    select8(value)
    {
      if (value == "" || value == false) {
        this.setState({
          active8: true
        })
      } else {
        this.setState({
          active8: false
        })
      }
    }
    select9(value)
    {
      if (value == "" || value == false) {
        this.setState({
          active9: true
        })
      } else {
        this.setState({
          active9: false
        })
      }
    }
    select10(value)
    {
      if (value == "" || value == false) {
        this.setState({
          active10: true
        })
      } else {
        this.setState({
          active10: false
        })
      }
    }
    select11(value)
    {
      if (value == "" || value == false) {
        this.setState({
          active11: true
        })
      } else {
        this.setState({
          active11: false
        })
      }
    }
    select12(value)
    {
      if (value == "" || value == false) {
        this.setState({
          active12: true
        })
      } else {
        this.setState({
          active12: false
        })
      }
    }
    select13(value)
    {
      if (value == "" || value == false) {
        this.setState({
          active13: true
        })
      } else {
        this.setState({
          active13: false
        })
      }
    }
    select14(value)
    {
      if (value == "" || value == false) {
        this.setState({
          active14: true
        })
      } else {
        this.setState({
          active14: false
        })
      }
    }
    select15(value)
    {
      if (value == "" || value == false) {
        this.setState({
          active15: true
        })
      } else {
        this.setState({
          active15: false
        })
      }
    }
    select16(value)
    {
      if (value == "" || value == false) {
        this.setState({
          active16: true
        })
      } else {
        this.setState({
          active16: false
        })
      }
    }
    select17(value)
    {
      if (value == "" || value == false) {
        this.setState({
          active17: true
        })
      } else {
        this.setState({
          active17: false
        })
      }
    }
    select18(value)
    {
      if (value == "" || value == false) {
        this.setState({
          active18: true
        })
      } else {
        this.setState({
          active18: false
        })
      }
    }
    selectnan(value)
    {
      if (value == "" || value == false) {
        this.setState({
          activenan: true
        })
      } else {
        this.setState({
          activenan: false
        })
      }
    }
    selectnv(value)
    {
      if (value == "" || value == false) {
        this.setState({
          activenv: true
        })
      } else {
        this.setState({
          activenv: false
        })
      }
    }
  JJ(){
    console.log(this.state.username)
    var person=[];
    person.push(this.state.username)
    person.push(this.state.sex)
    person.push(this.state.borndata)
    person.push(this.state.phone)
    person.push(this.state.address)
    person.push(this.state.blood)
    person.push(this.state.culture)
    person.push(this.state.profession)
    person.push(this.state.hight)
    person.push(this.state.wealth)
    person.push(this.state.BMI)
    Taro.request({
      url:"http://localhost:8080/shi1?b="+person,
     }).then(res=>{

     })
  }
    render (){
      return (
        <View>
          <View className="person">
            <Text>个人基本信息</Text>
          </View>
          <View className="form">
            <AtForm>
              <View className="input1">
                <AtInput
                  name='username'
                  onChange={this.usernameinput.bind(this)}
                  title='姓名'
                  value={this.state.username}
                  placeholder='请输入真实姓名'
                  />
              </View>
              <View className="input1">
                <AtInput
                  name='sex'
                  disabled
                  title='性别'
                  type='text'
                  value={this.state.sex}
                  onChange={this.sexinput.bind(this)}
                />
                <View className='s'>
                  <AtTag type='primary' circle  className='x' active={this.state.activenan} onClick={this.selectnan.bind(this,this.state.activenan)}>男</AtTag>
                  <AtTag type='primary' circle active={this.state.activenv} onClick={this.selectnv.bind(this,this.state.activenv)}>女</AtTag>
                </View>
              </View>
              <View className="input1">
                <AtInput
                  name='borndata'
                  title='出生日期'
                  type='text'
                  placeholder='请选择'
                  value={this.state.borndata}
                  onChange={this.borndatainput.bind(this)}
                />
                <View className='ss'>
                  <AtIcon value='chevron-right' size='30' color="black" ></AtIcon>
                </View>
              </View>
              <View className="input1">
                <AtInput
                  name='phone'
                  title='手机号码'
                  onChange={this.phoneinput.bind(this)}
                  type='text'
                  placeholder='请输入手机号码'
                  value={this.state.phone}
                />
              </View>
              <View className="input1">
                <AtInput
                  name='address'
                  title='住址'
                  type='text'
                  placeholder='请选择住址'
                  value={this.state.address}
                  onChange={this.addressinput.bind(this)}
                />
                <View className='ss'>
                  <AtIcon value='chevron-right' size='30' color="black" ></AtIcon>
                </View>
              </View>
              <View className="input1">
                <AtInput
                  name='nation'
                  title='民族'
                  type='text'
                  placeholder='请输入民族'
                  value={this.state.nation}
                  onChange={this.nationinput.bind(this)}
                />
              </View>
              <View className="input1">
                <AtInput
                  name='blood'
                  title='血型'
                  type='text'
                  placeholder='请选择'
                  value={this.state.blood}
                  onChange={this.bloodinput.bind(this)}
                />
                <View className='ss'>
                  <AtIcon value='chevron-right' size='30' color="black" ></AtIcon>
                </View>
              </View>
              <View className="input1">
                <AtInput
                  name='culture'
                  title='文化程度'
                  type='text'
                  placeholder='请输入最高学历'
                  value={this.state.culture}
                  onChange={this.cultureinput.bind(this)}
                />
              </View>
              <View className="input1">
                <AtInput
                  name='profession'
                  title='职业'
                  type='text'
                  placeholder='请输入职业'
                  value={this.state.profession}
                  onChange={this.professioninput.bind(this)}
                />
              </View>
              <View className="input1">
                <AtInput
                  name='hight'
                  title='身高'
                  type='text'
                  value={this.state.hight}
                  placeholder='请选择'
                  onChange={this.hightinput.bind(this)}
                />
                <View className='ss'>
                  <AtIcon value='chevron-right' size='30' color="black" ></AtIcon>
                </View>
              </View>
              <View className="input1">
                <AtInput
                  name='wealth'
                  title='体重'
                  type='text'
                  placeholder='请输入kg'
                  value={this.state.wealth}
                  onChange={this.wealthinput.bind(this)}
                />
              </View>
              <View className="input1">
                <AtInput
                  name='BMI'
                  title='BMI'
                  type='text'
                  value={this.state.BMI}
                  onChange={this.BMIinput.bind(this)}
                  placeholder='系统自动计算'
                />
              </View>
            </AtForm>
          </View>
          <View className="jibin">
            <View className='header'>
              <Text className='title'>疾病史</Text>
            </View>
            <View className="select">
              <View className="se">
                <AtTag  type='primary' size='small' circle='true' name="1" active={this.state.active1} onClick={this.select1.bind(this,this.state.active1)}>暂无</AtTag >
              </View>
              <View className="se">
                <AtTag  type='primary' size='small' circle='true' active={this.state.active2} onClick={this.select2.bind(this,this.state.active2)}>高血压</AtTag >
              </View>
              <View className="se">
                <AtTag  type='primary' size='small' circle='true' active={this.state.active3} onClick={this.select3.bind(this,this.state.active3)}>心脏病</AtTag >
              </View>
              <View className="se">
                <AtTag type='primary' size='small' circle='true' active={this.state.active4} onClick={this.select4.bind(this,this.state.active4)}>糖尿病</AtTag>
              </View>
              <View className="se">
                <AtTag  type='primary' size='small' circle='true' active={this.state.active5} onClick={this.select5.bind(this,this.state.active5)}>过敏性疾病</AtTag >
              </View>
              <View className="se">
                <AtTag  type='primary' size='small' circle='true' active={this.state.active6} onClick={this.select6.bind(this,this.state.active6)}>哮喘</AtTag >
              </View>
              <View className="se">
                <AtTag  type='primary' size='small' circle='true' active={this.state.active7} onClick={this.select7.bind(this,this.state.active7)}>白癜风</AtTag >
              </View>
              <View className="se">
                <AtTag  type='primary' size='small' circle='true' active={this.state.active8} onClick={this.select8.bind(this,this.state.active8)}>癫病</AtTag >
              </View>
              <View className="se">
                <AtTag  type='primary' size='small' circle='true' active={this.state.active9} onClick={this.select9.bind(this,this.state.active9)}>其它</AtTag >
              </View>
              <input
                className='qi'
                placeholder='请输入补充说明'
              />

            </View>
          </View>
          <View className="jibin">
            <View className='header'>
              <Text className='title'>食物/接触物过敏</Text>
            </View>
            <View className="select">
              <View className="se">
                <AtTag type='primary' size='small' circle='true' name='2' active={this.state.active10} onClick={this.select10.bind(this,this.state.active10)} >暂无</AtTag>
              </View>
              <View className="se">
                <AtTag type='primary' size='small' circle='true' active={this.state.active11} onClick={this.select11.bind(this,this.state.active11)}>芒果</AtTag>
              </View>
              <View className="se">
                <AtTag type='primary' size='small' circle='true' active={this.state.active12} onClick={this.select12.bind(this,this.state.active12)}>坚果类</AtTag>
              </View>
              <View className="se">
                <AtTag type='primary' size='small' circle='true' active={this.state.active13} onClick={this.select13.bind(this,this.state.active13)}>海鲜</AtTag>
              </View>
              <View className="se">
                <AtTag type='primary' size='small' circle='true' active={this.state.active14} onClick={this.select14.bind(this,this.state.active14)}>黄瓜</AtTag>
              </View>
              <View className="se">
                <AtTag type='primary' size='small' circle='true' active={this.state.active15} onClick={this.select15.bind(this,this.state.active15)}>花粉</AtTag>
              </View>
              <View className="se">
                <AtTag type='primary' size='small' circle='true' active={this.state.active16} onClick={this.select16.bind(this,this.state.active16)}>油漆</AtTag>
              </View>
              <View className="se">
                <AtTag type='primary' size='small' circle='true' active={this.state.active17} onClick={this.select17.bind(this,this.state.active17)}>动物皮毛</AtTag>
              </View>
              <View className="se">
                <AtTag type='primary' size='small' circle='true' active={this.state.active18} onClick={this.select18.bind(this,this.state.active18)}>其它</AtTag>
              </View>
              <input
                className='qi'
                placeholder='请输入补充说明'
              />

            </View>
          </View>
          <View className="tijiao">
            <AtButton type='primary' size='small' className="baocun" onClick={this.JJ}>保存</AtButton>
          </View>
          <View className='dsp'>
            <AtCalendar />
          </View>

        {/*<TabBar tabBarCurrent={2}></TabBar>*/}
        </View>



      );
    }
  }
